Description:
CSC detects comparisons of the short operand with the char operand.
Since the char type is unsigned, and is converted to int by
filling the high half of the word with 0, and the short type
is signed and is converted to int using a signed extension, values in
the range 0x8000..0xFFFF will not be considered equal in such a comparison.
Incorrect:
bool Compare(char c, short s) {
return c == s;
}
Correct:
bool Compare(char c, short s) {
return c == (char)(s & 0xffff);
}